package psi

import "strings"

/*
自定义服药闹钟设置指令
平台发送:
[DW*YYYYYYYYYYYYYYY*LEN*REMIND_CH_MEDICINE2,时间 1-开关，时间 2-开关，时间 3-开关,周几]
实例:
[DW*334588000000156*0026*REMIND_CH_MEDICINE2,09:00-0,14:00-0,18:00-0,1111111]
终端回复:
[DW*YYYYYYYYYYYYYYY*LEN*REMIND_CH_MEDICINE2]
实例:[DW*334588000000156*000E*REMIND_CH_MEDICINE2]
说明:闹铃格式为：时间-开关，周几（周日到周六）
*/

// 自定义服药闹钟设置指令
type REMIND_CH_MEDICINE2 struct {
	Time1 string // 时间 1-开关
	Time2 string // 时间 2-开关
	Time3 string // 时间 3-开关
	Week  string // 周几
}

func DealREMIND_CH_MEDICINE2(method string, params map[string]interface{}) (string, error) {
	var remind REMIND_CH_MEDICINE2
	err := MapToStruct(params, &remind)
	if err != nil {
		return "", err
	}
	var messageList []string
	messageList = append(messageList, "REMIND_CH_MEDICINE2")
	messageList = append(messageList, remind.Time1)
	messageList = append(messageList, remind.Time2)
	messageList = append(messageList, remind.Time3)
	messageList = append(messageList, remind.Week)
	message := strings.Join(messageList, ",")
	return message, nil
}
